﻿///***************************************************************
/// 시  스  템 : Updms.Mny.Dac
/// 단위시스템 : MNY
/// 계      층 : Data Access Layer
/// 프로그램명 : Mny_Dac_UPDMS_MNY_IN_OUT_MGT
/// 파  일  명 : Mny_Dac_UPDMS_MNY_IN_OUT_MGT.cs
/// 설      명 : 금전출납관리
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-08-04 송시명   최초 작성
///***************************************************************
using System.Data;
using System.Data.SqlClient;
using System.EnterpriseServices;
using System.Runtime.InteropServices;

using SMFramework.Data;

namespace Updms.Mny.Dac
{
	[ComVisible(true)]
	[Transaction(TransactionOption.Supported)]
	[JustInTimeActivation(true)]
	public class Mny_Dac_UPDMS_MNY_IN_OUT_MGT : Base.AppFramework.DacBase
	{
		public Mny_Dac_UPDMS_MNY_IN_OUT_MGT()
		{
		}

		#region NT [GetSearchCount]
		
		[AutoComplete]
		public int GetSearchCount(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Get_Search_Count";
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			
			return (int)_agent.ExecuteScalar(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region NT [SelectProcess]
		
		[AutoComplete]
		public DataSet SelectProcess(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Select_Paging";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_MNY_IN_OUT_MGT", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region NT [CheckBalance]
		/// <summary>
		/// 잔액검증
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet CheckBalance(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Check_Balance";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_MNY_IN_OUT_MGT", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetBalanceAmountList]
		/// <summary>
		/// 생활비 차감관리
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetBalanceAmountList(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Get_Balance_Amount_List";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_MNY_IN_OUT_MGT", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetLivingCostForBalance]
		/// <summary>
		/// 생활비 차감관리 - 차감대상 생활비 목록
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetLivingCostForBalance()
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Get_Living_Cost_For_Balance";

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_MNY_IN_OUT_MGT", ds, null, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetMonthlyBalance]
		/// <summary>
		/// 월별잔액
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public int GetMonthlyBalance(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Get_Monthly_Balance";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return (int)_agent.ExecuteScalar(strSql, paramArray, CommandType.StoredProcedure);
		}

		#endregion
		
		

		#region RT [Insert]
		
		[AutoComplete]
		public int Insert(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Insert";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}	
		
		#endregion

		#region RT [Insert_Xml]
		/// <summary>
		/// Mny4010b에서 호출
		/// </summary>
		/// <param name="ls_data"></param>
		/// <returns></returns>
		[AutoComplete]
		public int Insert_Xml(string ls_xml)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Insert_Xml";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_xml", ls_xml)
			};

			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region RT [Update]
		
		[AutoComplete]
		public int Update(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Update";			
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region RT [Delete]
		
		[AutoComplete]
		public int Delete(string ls_xml)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Delete";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_xml", ls_xml)
			};
			
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region RT [SetLivingCostForBalance]
		/// <summary>
		/// 생활비 차감관리 - 생활비 차감처리
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public int SetLivingCostForBalance(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_MNY_IN_OUT_MGT_Set_Living_Cost_For_Balance";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}

		#endregion
	}
}
